package 笔试.秋招2023.数科360.T2;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author 张从龙
 * @version [1.0.0, 2022/8/27]
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        //n, m
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int [] arr1 = new int[m];
        int [] arr2 = new int[m];
        int [] arr3 = new int[m];
        //读三行
        for (int i = 0; i < m; i++) {
            arr1[i] = scanner.nextInt();
        }
        for (int i = 0; i < m; i++) {
            arr2[i] = scanner.nextInt();
        }

        for (int i = 0; i < m; i++) {
            arr3[i] = scanner.nextInt();
        }
        Arrays.sort(arr3);
        int res = 0;
        //计算路径最小值, 联通所有节点的最短路径
        //n个节点，n-1条边（共m条边）
        for (int i = 0; i < n-1; i++) {
            res += arr3[i];
        }
        System.out.println(res);
    }
}
